import {postObj, postObjWithoutToken} from "@/services/api_service";

type TypePaymentProps = {
    ticket_type: string,
    ticket_type_name: string,
    route_id: string,
    user_id?: string;
    vehicle_id?: string;
    vehicle?: {
        registration_number: string,
        vehicle_type: string,
        length: number,
        weight: number,
    };
    amount: number;
}

export async function createPayment(data: TypePaymentProps, token?: string) {
    if (token === "withToken") {
        return await postObj('/api/payments/create-payment/', {
            ...data
        });
    } else {
        return await postObjWithoutToken('/api/payments/create-payment/', {
            ...data
        });
    }
}
